package com.echoesnet.echoesshortvideo.views;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Copyright (C) 2018 科技发展有限公司
 * 完全享有此软件的著作权，违者必究
 *
 * @author ben
 * @version 1.0
 * @modifier
 * @createDate 2018/5/5 18:42
 * @description
 */
public class MySwipeRefreshLayout extends SwipeRefreshLayout
{
    private boolean needSwipe;
    public MySwipeRefreshLayout(@NonNull Context context)
    {
        super(context);
    }

    public MySwipeRefreshLayout(@NonNull Context context, @Nullable AttributeSet attrs)
    {
        super(context, attrs);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev)
    {
        if (needSwipe)
           return super.onInterceptTouchEvent(ev);
        else
            return false;
    }

    public void setNeedSwipe(boolean needSwipe)
    {
        this.needSwipe = needSwipe;
    }
}
